patterns = {
  email: function(text){
    return /^(?:[a-z0-9]+[_\-+.]+)*[a-z0-9]+@(?:([a-z0-9]+-?)*[a-z0-9]+.)+([a-z]{2,})+$/i.test(text)
  },
  date: function(text){
    var reg = /^([1-2]\d{3})([-/.])?(1[0-2]|0?[1-9])([-/.])?([1-2]\d|3[01]|0?[1-9])$/
        , taste, d, year, month, day

      if (!reg.test(text)) {
        return false
      }

      taste = reg.exec(text)
      year = +taste[1]
      month = +taste[3] - 1
      day = +taste[5]
      d = new Date(year, month, day)

      return year === d.getFullYear() && month === d.getMonth() && day === d.getDate()
  },
  mobile: function(text){
    return /^1[3-9]\d{9}/.test(text)
  },
  tel: function(text){
    return /^(?:(?:0\d{2,3}[- ]?[1-9]\d{6,7})|(?:[48]00[- ]?[1-9]\d{6}))$/.test(text)
  }
}

console.log(patterns.email("abb@baa.com"))
console.log(patterns.date('20150102'))
console.log(patterns.mobile('13566666666'))
console.log(patterns.tel('4008888988'))
